Inside Macintosh: QuickTime Components

| Previous | Chapter contents | Chapter top | Section top | Next |

Configuring Movie Data Import Components

Your component may provide one or more configuration functions. These functions allow applications to configure your component before the Movie Toolbox calls your component to start the import process. Note that applications may call these functions directly.

All of these functions are optional. If your component receives a request that it does not support, you should return the badComponentSelector error code. In addition, your component should work properly even if none of these functions is called.

These functions address a variety of configuration issues. The MovieImportSetSampleDuration function allows an application to set your component's sample duration. Use the MovieImportSetDuration function to control the duration of the imported data. Applications can use the MovieImportSetDimensions function to specify the spatial dimensions of a new track. Use the MovieImportSetSampleDescription function to supply a sample description structure to your movie data import component.

The MovieImportSetMediaFile function allows applications to direct your component's output to a specific media file. Applications can provide additional data to your component by calling the MovieImportSetAuxiliaryData function. The MovieImportSetChunkSize function allows applications to control the chunk size in the new media. Applications can inform you that the source data came from the scrap by calling your MovieImportSetFromScrap function.

Applications can specify a progress function for use by your component by calling the MovieImportSetProgressProc function.

Applications can instruct your component to display its user dialog box by calling the MovieImportDoUserDialog function.

MovieImportSetDuration

The MovieImportSetDuration function allows an application to control the duration of the data that your component pastes into the target movie.

pascal ComponentResult MovieImportSetDuration
                                         (MovieImportComponent ci,
                                          TimeValue duration);
ci
Identifies the application's connection to your movie data import component.

duration
Specifies the duration in the movie's time scale. If this parameter is set to 0, then you may paste any amount of movie data that is appropriate for the data to be imported.

DESCRIPTION

Applications may use the MovieImportSetDuration function to set the duration of the data to be pasted by your movie data import component. This duration is expressed in the movie's time scale.

If your component supports paste operations (that is, your component allows the application to set the movieImportInParallel flag to 1 with the MovieImportHandle or MovieImportFile function), then you must support this function. If an application calls this function and sets a duration limit, you must abide by that limit. This function is not valid for insert operations (where the movieImportInParallel flag is set to 0).

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetSampleDuration

The MovieImportSetSampleDuration function allows an application to set the sample duration for new samples to be created with your component.

pascal ComponentResult MovieImportSetSampleDuration
                                          (MovieImportComponent ci,
                                         TimeValue duration,
                                         TimeScale scale);
ci
Identifies the application's connection to your movie data import component.

duration
Specifies the sample duration in units specified by the scale parameter.

scale
Specifies the time scale for the duration value. This may be any arbitrary time scale; that is, it may not correspond to the movie's time scale. You should convert this time scale to the movie's time scale before using the duration value, using the Movie Toolbox's ConvertTimeScale function.

DESCRIPTION

Applications may use the MovieImportSetSampleDuration function to set the duration of samples to be added by your movie data import component. This duration is expressed in an arbitrary time scale.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetSampleDescription

The MovieImportSetSampleDescription function allows an application to provide a sample description to your movie data import component.

pascal ComponentResult MovieImportSetSampleDescription
                                          (MovieImportComponent ci,
                                          SampleDescriptionHandle desc,
                                          OSType mediaType);
ci
Identifies the application's connection to your movie data import component.

desc
Contains a handle to a sample description. Your component must not dispose of this handle. If you want to save any data from the sample description, be sure to copy it at this time.

mediaType
Specifies the type of sample description referred to by the desc parameter. If the desc parameter refers to an image description structure, this parameter is set to VideoMediaType ( 'vide' ); for sound description structures, this parameter is set to SoundMediaType ( 'soun' ).

DESCRIPTION

Applications may use the MovieImportSetSampleDescription function to supply a sample description to your movie data import component. This can be useful in cases where your component must transform the data before adding it to the movie's media. For example, your component may be responsible for adding image data to a movie. In this case, you may allow applications to specify image-compression parameters by supplying a formatted image description structure.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetMediaFile

The MovieImportSetMediaFile function allows an application to specify a media file that is to receive the imported movie data.

pascal ComponentResult MovieImportSetMediaFile
                                         (MovieImportComponent ci,
                                          AliasHandle alias);
ci
Identifies the application's connection to your movie data import component.

alias
Identifies the media file that is to receive the imported movie data. Your component must make a copy of this parameter. You should not dispose of it.

DESCRIPTION

Applications may use the MovieImportSetMediaFile function to specify a destination media file for imported movie data. By default, your movie data import component should add new data to an existing media file that is associated with the movie. However, you may choose to allow applications to specify an alternative destination file. This can be useful when your component is importing data into a new track. In this case, the application can use this function to tell your component where the media's data should reside.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetDimensions

The MovieImportSetDimensions function allows an application to specify a new track's spatial dimensions.

pascal ComponentResult MovieImportSetDimensions
                                         (MovieImportComponent ci, Fixed width,
                                          Fixed height);
ci
Identifies the application's connection to your movie data import component.

width
Indicates the width, in pixels, of the track rectangle. This parameter, along with the height parameter, specifies a rectangle that surrounds the image that is to be displayed when the current media is played. This value corresponds to the x coordinate of the lower-right corner of the rectangle, and it is expressed as a fixed-point number.

height
Indicates the height, in pixels, of the track rectangle. This value corresponds to the y coordinate of the lower-right corner of the rectangle, and it is expressed as a fixed-point number.

DESCRIPTION

Applications may use this function to specify the spatial dimensions of a new track. Although your movie data import component may not change the spatial characteristics of an existing track, if you are importing image data into a new track, you may choose to allow applications to specify the spatial characteristics of the new track.

If you want to change the track's matrix, use the Movie Toolbox's SetTrackMatrix function after performing the import operation.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetChunkSize

The MovieImportSetChunkSize function allows an application to specify the amount of data your component works with at a time.

pascal ComponentResult MovieImportSetChunkSize
                                         (MovieImportComponent ci,
                                          long chunkSize);
ci
Identifies the application's connection to your movie data import component.

chunkSize
Specifies the number of seconds of data your movie data import component places into each chunk of movie data. This parameter may not be set to a value less than 1.

DESCRIPTION

The chunk size controls the amount of data in each of a media's data chunks (for more information about data chunks in a media, see the chapter "QuickTime Movie Format" in Inside Macintosh: QuickTime ). Generally, your component should determine a reasonable default chunk size, based on the type of data you are importing. However, you may choose to allow applications to override your default value--this can be especially useful for sound data, where the chunk size affects the quality of sound playback.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetProgressProc

The MovieImportSetProgressProc function allows an application to assign a movie progress function.

pascal ComponentResult MovieImportSetProgressProc
                                         (MovieImportComponent ci,
                                          MovieProgressUPP proc,
                                          long refcon);
ci
Identifies the application's connection to your movie data import component.

proc
Contains a pointer to the application's movie progress function. See the chapter "Movie Toolbox" in Inside Macintosh: QuickTime for a complete description of the interface supported by movie progress functions. If this parameter is set to nil , the application is removing its progress function. In this case, your component should stop calling the progress function.

refcon
Specifies a reference constant. Your component should pass this constant back to the application's progress function whenever you call that function.

DESCRIPTION

Some data import operations may be time consuming, and application developers may therefore choose to display progress information to the user. Your component provides this information to an application's progress function. As your component processes an import request, you should call the progress function occasionally in order to report on the progress of the operation. Use an operation code value of progressOpImportMovie . The application can then present this information to the user.

These progress functions must support the same interface as Movie Toolbox progress functions. That interface is discussed in the chapter "Movie Toolbox" in Inside Macintosh: QuickTime . Note that this interface not only allows you to report progress to the application, but also allows the application to cancel the request.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportSetAuxiliaryData

The MovieImportSetAuxiliaryData function allows an application to provide additional data to your component. Your component can then use this data during the data import process.

pascal ComponentResult MovieImportSetAuxiliaryData
                                         (MovieImportComponent ci,
                                          Handle data,
                                          OSType handleType);
ci
Identifies the application's connection to your movie data import component.

data
Contains a handle to the additional data. Your component should not dispose of this handle. Be sure to copy any data you need to keep.

handleType
Identifies the type of data in the specified handle.

DESCRIPTION

The MovieImportSetAuxiliaryData function allows your component to accept additional data for use during the data import process. Your component may use this data in any way that is appropriate for a given import operation. For example, if your component imports data stored in 'TEXT' handles, you might choose to accept style information for that text. An application could provide that style information in a 'styl' handle supplied to your component by calling this function.

Your component should expect the application to call this function before the import process begins.

RESULT CODES

unsupportedAuxiliaryImportData

-2057

Cannot work with specified handle type

badComponentSelector

0x80008002

Function not supported

MovieImportSetFromScrap

The MovieImportSetFromScrap function allows an application to indicate that the source data resides on the scrap.

pascal ComponentResult MovieImportSetFromScrap
                                         (MovieImportComponent ci,
                                         Boolean fromScrap);
ci
Identifies the application's connection to your movie data import component.

fromScrap
Indicates whether or not the source data resides on the scrap. This parameter is set to true if the data originated on the scrap; otherwise, the parameter is set to false .

DESCRIPTION

The MovieImportSetFromScrap function allows an application to indicate that the data to be imported originated on the scrap. In some cases, your component may be able to use this information during the import process. For example, you may establish the convention that additional data that is pertinent to an import operation should be stored on the scrap along with the data to be imported. Your component can then look in the scrap for the additional data.

RESULT CODE

badComponentSelector

0x80008002

Function not supported

MovieImportDoUserDialog

The MovieImportDoUserDialog function allows an application to request that your component display its user dialog box.

pascal ComponentResult MovieImportDoUserDialog
                                         (MovieImportComponent ci,
                                          const FSSpec *theFile,
                                          Handle theData, Boolean *canceled);
ci
Identifies the application's connection to your movie data import component.

theFile
Contains a pointer to a valid file specification. If the import request pertains to a file, the application must specify the source file with this parameter and set the parameter theData to nil . If the request is for a handle, this parameter is set to nil .

theData
Contains a handle to the data to be imported. If the import request pertains to a handle, the application must specify the source of the data with this parameter, and set the parameter theFile to nil . If the request is for a file, this parameter is set to nil .

canceled
Contains a pointer to a Boolean value. Your component should set this Boolean value to reflect whether the user cancels the dialog box. If the user cancels the dialog box, set the Boolean value to true . Otherwise, set it to false .

DESCRIPTION

Your movie data import component may support a user dialog box that allows the user to configure an import operation. For components that support such a dialog box, the MovieImportDoUserDialog function allows an application to tell you when to display the dialog box to the user.

If your component supports a user dialog box, be sure to set the hasMovieImportUserInterface flag in your component's componentFlags field.

RESULT CODE
badComponentSelector 0x8000800 Function not supported

© 1997 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |